package com.googlecode.flealancemarket.service.commands.impl;

import com.googlecode.flealancemarket.metamodel.PrivateMessage;
import com.googlecode.flealancemarket.service.commands.ChangeMessageRead;
import com.googlecode.flealancemarket.service.facades.MessagesFacade;

public class ChangeMessageReadImpl implements ChangeMessageRead {

    private PrivateMessage message;
    private MessagesFacade facade;
    private boolean read;

    public PrivateMessage getMessage() {
        return message;
    }

    public void setMessage(PrivateMessage message) {
        this.message = message;
    }

    public MessagesFacade getFacade() {
        return facade;
    }

    public void setFacade(MessagesFacade facade) {
        this.facade = facade;
    }

    public void execute(){
        message.setRead(read);
        facade.savePrivateMessage(message);
    }

    public boolean isRead() {
        return read;
    }

    public void setRead(boolean read) {
        this.read = read;
    }

}
